package com.sample.springconf;

import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {
    @Bean
    @ConfigurationProperties(prefix="ds.master", locations = "classpath:application-test.properties")
    public DataSource masterDS() {
        return DataSourceBuilder.create().type(org.apache.commons.dbcp.BasicDataSource.class).build();
    }

    //@Bean
    //@ConfigurationProperties(prefix="ds.slave.1")
    //public DataSource slave_1_DS() {
    //    return DataSourceBuilder.create().type(org.apache.commons.dbcp.BasicDataSource.class).build();
    //}
//
//    @Bean
//    @ConfigurationProperties(prefix="ds.slave.2")
//    public DataSource slave_2_DS() {
//        return DataSourceBuilder.create().type(org.apache.commons.dbcp.BasicDataSource.class).build();
//    }

}
